import $http from '../config/api/index';

export const $get = (url, params, status = "success") => {
    return new Promise((r, j) => {
        $http.get(url, { params }).then(res => {
            if (Array.isArray(res) || res[status]) {
                r(res)
            } else {
                j(res)
            }
        })
    })
}

export const $post = (url, params, status = "success") => {
    return new Promise((r, j) => {
        $http.post(url, params).then(res => {
            if (Array.isArray(res) || res[status]) {
                r(res)
            } else {
                j(res)
            }
        })
    })
}


export const $get2 = (url, params) => $http.get(url, { params });